class Tool:

    # 使用赋值语句定义类属性，记录所有工具对象的数量
    count = 0
    def __init__(self,name):
        self.name = name
        Tool.count += 1


tool = Tool("斧头")
tool2 = Tool("2")
tool3 = Tool("4")

print(Tool.count)